|
|
|
|
|
|
|
' show properties of the querydef
strMsg = ""
For Each pr In qd.Properties
strMsg = strMsg & pr.Name
strMsg = strMsg & " = "
strMsg = strMsg & pr.Value
strMsg = strMsg & " {"
strMsg = strMsg & ShowType(pr.Type)
strMsg = strMsg & "}" & vbCrLf
Next
'
MsgBox strMsg, vbInformation, "QueryDef"
'
db.Close
ws.Close
Set pr = Nothing
Set qd = Nothing
Set db = Nothing
Set ws = Nothing
'
Exit Sub
'
LocalErr:
strMsg = strMsg & "<err>"
Resume Next
'
End Sub |
|
|
|
|
|
|
|
|
Save and run the project. Check your final screen against the one in Figure 9.19. |
|
|
|
|
|
|
|
|
Figure 9.19.
The results of creating a QueryDef object. |
|
|
|
|
|
|
|
|
The code in Listing 9.20 exposes one very important aspect of creating QueryDef objects that you might not have noticed. There is no Append method to add the QueryDef to the QueryDefs collection. It is added automatically. As soon as you define the QueryDef with a name property, you have added it to the collection. |
|
|
|
|
|